/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.ove.openmath.jome.ctrl.amto;

/**
 *
 * @author Mr.Sam
 */
import fr.ove.openmath.jome.ctrl.linear.events.LinearParserEvent;
import fr.ove.openmath.jome.ctrl.amto.AbstractMathTreeObject;

/**
* The abstract math tree object of a complex cartesian number.
*
* @author © 2000 DIRAT Laurent
* @version 1.0  25/02/2000
*/
public class ComplexPolar extends AbstractMathTreeObject {
    /**
    * The constructor.
    * @param identifier the identifier of the instance.
    * @param token the identifier of the instance by the mean of the event sent.
    */
    public ComplexPolar() {
        super("complex_polar", -1); // -1 pour mettre qque chose, mais on ne s'en sert pas.
    }

    /**
    * "Flushes" the object as a sequence of events for the building of the model
    */
    public void flush() {
        LinearParserEvent linearParserEvent = new LinearParserEvent(getEventSource());
        flushChild(getChild(0), 0);
        linearParserEvent.setToken(LinearParserEvent.MULTIPLICATION, "*");
        fireLinearParserEvent(linearParserEvent);
        linearParserEvent.setToken(LinearParserEvent.RESERVED, "E");
        fireLinearParserEvent(linearParserEvent);
        linearParserEvent.setToken(LinearParserEvent.POWER, "^");
        fireLinearParserEvent(linearParserEvent);
        linearParserEvent.setToken(LinearParserEvent.OPEN_PAREN, "(");
        fireLinearParserEvent(linearParserEvent);
        linearParserEvent.setToken(LinearParserEvent.RESERVED, "I");
        fireLinearParserEvent(linearParserEvent);
        linearParserEvent.setToken(LinearParserEvent.MULTIPLICATION, "*");
        fireLinearParserEvent(linearParserEvent);
        flushChild(getChild(1), 1);
    }
}
